<template>
  <div class="other-settings views-container">
    <choose-files ref="chooseFilesIcon" :config="chooseFilesConfig" :changeEvt="uploadChange"></choose-files>
    <choose-link ref="chooseIconLink" :config="chooseIconLinkConfig" :changeEvt="uploadIconFileChange"></choose-link>
    <div class="wlm-form">
      <div class="wlm-form-header">分享设置</div>
      <div class="wlm-form-content">
        <el-form ref="platform" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="180px" class="retail-form" label-position="right">
          <el-form-item label="分享标题">
            <el-input type="textarea" v-model.trim="formFormatData.formData.share_title" :autosize="{ minRows: 1, maxRows: 4}" style="width:80%;"></el-input>
          </el-form-item>
          <el-form-item label="分享描述">
            <el-input type="textarea" :autosize="{ minRows: 1, maxRows: 4}" v-model.trim="formFormatData.formData.share_describe" style="width:80%;"></el-input>
          </el-form-item>
          <el-form-item label="公众号分享图片">
            <choose-files ref="chooseFiles" :config="chooseLogoConfig" :changeEvt="formFormatFiltersChange"></choose-files>
            <div class="form-help">建议尺寸100*100</div>
          </el-form-item>
          <el-form-item label="小程序分享图片">
            <choose-files ref="chooseFiles" :config="chooseCopyrightConfig" :changeEvt="formFormatFiltersChange"></choose-files>
            <div class="form-help">建议尺寸500*400</div>
          </el-form-item>
          <el-form-item label="小程序是否显示关注公众号">
            <el-radio-group v-model="formFormatData.formData.app_show">
              <el-radio label="1">关注</el-radio>
              <el-radio label="2">不关注</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-form>
      </div>
    </div>

    <!-- <div class="wlm-form" v-if="JSON.stringify($store.getters.power).indexOf('wechat')>-1"> -->
    <div class="wlm-form">
      <div class="wlm-form-header flex-row flex-justify-b">
        海报设置
        <el-tooltip class="item" effect="dark" content="点击后清除海报的缓存信息和图片，在点击后的5秒 - 60秒后有效" placement="bottom">
          <el-button @click="clearPoster" plain size="small">清除海报缓存</el-button>
        </el-tooltip>
      </div>
      <div class="wlm-form-content">
        <el-alert :closable="false" style="padding: 20px;margin-bottom:20px;" title="以下设置仅针对微信公众号和微信小程序的默认海报生效，自定义海报则以自定义海报相关设置为准" type="warning"></el-alert>
        <el-form ref="platform" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="180px" class="retail-form" label-position="right">
          <el-form-item label="海报二维码">
            <el-radio-group v-model="formFormatData.formData.qr_type" @change="qrtypebtn">
              <el-radio label="1">普通二维码</el-radio>
              <el-radio label="2">关注二维码</el-radio>
            </el-radio-group>
            <p class="form-help">关注二维码用户扫码以后，先关注公众号，然后自动回复小程序或图文</p>
          </el-form-item>
          <el-form-item label="回复类型">
            <el-radio-group v-model="formFormatData.formData.reply_type">
              <el-radio label="1">微信小程序</el-radio>
              <el-radio label="2">微信图文</el-radio>
            </el-radio-group>
            <p class="form-help">用户扫码关注公众号以后，系统回复类型。未开通微信小程序渠道，默认都回复微信图文</p>
          </el-form-item>
          <el-form-item label="生成海报方式">
            <el-radio-group v-model="formFormatData.formData.poster_create_type">
              <el-radio label="0">前端生成</el-radio>
              <el-radio label="1">后端生成</el-radio>
            </el-radio-group>
            <p class="form-help">前端生成：生成海报快慢与用户当前网络情况有关。</p>
            <p class="form-help">后端生成：生成海报快慢与服务器性能有关，自定义海报上传的背景或图片高宽必须以组件高度标准来做。</p>
          </el-form-item>
           <el-form-item label="微信公众号二维码期限" v-if="formFormatData.formData.qr_type=='2'">
            <el-radio-group v-model="formFormatData.formData.permanent">
              <el-radio label="1">临时</el-radio>
              <el-radio label="2">永久</el-radio>
            </el-radio-group>
            <p class="form-help">微信公众号的配置！</p>
          </el-form-item>
        </el-form>
      </div>
    </div>

    <div class="wlm-form">
      <div class="wlm-form-header flex-row flex-justify-b">
        直播设置
        <el-tooltip class="item" effect="dark" content="点击后清除直播的缓存信息，在点击后的5秒 - 60秒后有效" placement="bottom">
          <el-button @click="clearDirectDroadcas" plain size="small">清除直播缓存</el-button>
        </el-tooltip>
      </div>
      <div class="wlm-form-content">
        <el-form ref="platform" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="180px" class="retail-form" label-position="right">
          <el-form-item label="直播标题">
            <el-input v-model.trim="formFormatData.formData.live_title" style="width:80%;"></el-input>
          </el-form-item>
          <el-form-item label="直播分享描述">
            <el-input type="textarea" :autosize="{ minRows: 1, maxRows: 4}" v-model.trim="formFormatData.formData.live_text" style="width:80%;"></el-input>
          </el-form-item>
          <el-form-item label="小程序分享图片">
            <choose-files ref="chooseFiles" :config="chooseCopyrightConfigs" :changeEvt="formFormatFiltersChange"></choose-files>
            <div class="form-help">建议尺寸500*400</div>
          </el-form-item>
          <!-- <el-form-item label="小程序是否显示关注公众号">
            <el-radio-group v-model="formFormatData.formData.app_show">
              <el-radio label="1">关注</el-radio>
              <el-radio label="2">不关注</el-radio>
            </el-radio-group>
          </el-form-item> -->
        </el-form>
      </div>
    </div>

    <div class="wlm-form">
      <div class="wlm-form-header">优惠券设置</div>
      <div class="wlm-form-content">
        <el-form ref="platform" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="180px" class="retail-form" label-position="right">
          <el-form-item label="优惠券名称">
            <el-input placeholder="优惠券名称" v-model="formFormatData.formData.coupon.coupon_title"></el-input>
          </el-form-item>
          <el-form-item label="满减券">
            <el-input placeholder="满减券" v-model="formFormatData.formData.coupon.coupon_reduction"></el-input>
          </el-form-item>
          <el-form-item label="折扣券">
            <el-input placeholder="折扣券" v-model="formFormatData.formData.coupon.coupon_rebate"></el-input>
          </el-form-item>
          <el-form-item label="运费券">
            <el-input placeholder="运费券" v-model="formFormatData.formData.coupon.coupon_freight"></el-input>
          </el-form-item>
          <el-form-item label="随机券">
            <el-input placeholder="随机券" v-model="formFormatData.formData.coupon.coupon_random"></el-input>
          </el-form-item>
            <el-form-item label="优惠券到期前" prop="order.expire_tips">
                    <div class="input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                        <el-input  size="small" v-model="formFormatData.formData.coupon.coupon_over_tip"></el-input>
                        <div class="wlm-input-append append-right" style="position: absolute;left: 230px;top: 0px;">天提醒</div>
                    </div>
                    <div class="form-help">注：如果一个优惠券需要多次提醒，请将多个数字用“|”隔开，如：0.5|1|1.5</div>
                </el-form-item>
        </el-form>
      </div>
    </div>
    <div class="wlm-form">
      <div class="wlm-form-header">弹幕设置</div>
      <div class="wlm-form-content">
        <el-form ref="platform" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="180px" class="retail-form" label-position="right">
          <el-form-item label="是否开启弹幕">
            <el-radio-group v-model="formFormatData.formData.barrage.is_barrage">
              <el-radio label="1">开启</el-radio>
              <el-radio label="2">关闭</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div class="wlm-form">
      <div class="wlm-form-header">快递物流设置</div>
      <div style="margin:20px 0px 0px 200px;">
         <el-radio-group v-model="formFormatData.formData.type">
          <el-radio label="1">快递鸟</el-radio>
          <el-radio label="2">阿里云快递</el-radio>
          <el-radio label="3">快递100</el-radio>
        </el-radio-group>
      </div>
      <div class="wlm-form-content">
        <el-form
ref="platform"
:model="formFormatData.formData"
        :rules="formFormatData.rules"
size="small"
label-width="180px"
        class="retail-form"
label-position="right"
        v-if="formFormatData.formData.type==1"
        >
          <el-form-item label="快递鸟app_key">
            <el-input type="text" name="" id="" v-model="formFormatData.formData.kdn_AppKey"></el-input>
          </el-form-item>
          <el-form-item label="快递鸟商户ID">
            <el-input type="text" name="" id="" v-model="formFormatData.formData.kdn_EBusinessID"></el-input>
          </el-form-item>
          <el-form-item label="RequestType">
            <el-input type="text" name="" id="" v-model="formFormatData.formData.kdnType"></el-input>
            <div class="form-help">快递鸟会员套餐(付费版) 自开通当日起一个月(30 天)内，免费即时查询接口 (RequestType 为 1002)仍可继续请求测试使用，一个月后将关闭测试权限，会员用户(付费版会员套餐)需调用在途监控接口(RequestType 为 8001)。</div>
          </el-form-item>
        </el-form>
         <el-form
ref="platform"
:model="formFormatData.formData"
        :rules="formFormatData.rules"
size="small"
label-width="180px"
        class="retail-form"
label-position="right"
        v-if="formFormatData.formData.type==2"
        >
          <el-form-item label="阿里云appcode">
            <el-input type="text" name="" id="" v-model="formFormatData.formData.appcode"></el-input>
          </el-form-item>
        </el-form>
        <el-form
ref="platform"
:model="formFormatData.formData"
        :rules="formFormatData.rules"
size="small"
label-width="180px"
        class="retail-form"
label-position="right"
        v-if="formFormatData.formData.type==3"
        >
          <el-form-item label="customer">
            <el-input type="text" name="" id="" v-model="formFormatData.formData.customer"></el-input>
          </el-form-item>
          <el-form-item label="授权KEY">
            <el-input type="text" name="" id="" v-model="formFormatData.formData.key"></el-input>
          </el-form-item>
        </el-form>
      </div>
    </div>


    <div class="wlm-form">
      <div class="wlm-form-header">腾讯地图KEY</div>
          <el-form
ref="platform"
:model="formFormatData.formData"
        :rules="formFormatData.rules"
size="small"
label-width="180px"
        class="retail-form"
label-position="right"
        >
         <div style="margin:20px 0px 0px 0px;">
          <el-form-item label="腾讯地图KEY">
            <el-input type="text"  v-model="formFormatData.formData.tecent_map_key" style="width:40%;"></el-input>
            <div class="form-help">不填则调用系统默认KEY,为提高接口稳定性，建议自行填写</div>
          </el-form-item>
         </div>
          </el-form>
    </div>


    <div class="wlm-form">
      <div class="wlm-form-header flex-row">
        商品详情左下角操作设置
        <el-button v-if="!independent" :data-query="JSON.stringify({type:'icon'})" style="margin-left:20px" size="mini" plain icon="document" v-exceldown="{path:'',query: {},redirect: `${orga}/addons/weliam_areashop/web/assets/common/image/icon.zip?`}">下载默认图标</el-button>
        <el-button v-if="independent" :data-query="JSON.stringify({type:'icon'})" style="margin-left:20px" size="mini" plain icon="document" v-exceldown="{path:'',query: {},redirect: `${orga}/web/assets/common/image/icon.zip?`}">下载默认图标</el-button>
         <div class="form-help" style="margin-left:20px;">图标建议尺寸：100*100</div>
      </div>
      <div class="wlm-form-content">
        <el-form ref="platform" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="180px" class="retail-form" label-position="right">
          <!-- <el-form-item label="客服按钮">
                    <el-radio-group v-model="formFormatData.formData.customer">
                        <el-radio label="no">隐藏</el-radio>
                        <el-radio label="service">客服</el-radio>
                        <el-radio label="dial">拨号</el-radio>
                        <el-radio label="share">分享</el-radio>
                        <el-radio label="share_make">分享赚</el-radio>
                    </el-radio-group>
          </el-form-item>-->
          <div class="fileItemHeader flex-row flex-align-c">
            <p class="icon">图标</p>
            <p class="text">自定义文字</p>
            <p class="link">自定义链接</p>
          </div>
          <div v-for="(saveitem, saveindex) in formFormatData.formData.button" v-dragging="{ item: saveitem, list: formFormatData.formData.button, group: 'buttonLis'}" v-bind:key="saveindex" class="fileItem flex-row flex-align-c flex-justify-b">
            <div class="flex-row flex-align-c">
              <p class="fileName">{{saveitem.title}}</p>
              <img class="update-load" v-if="saveitem.image" :src="saveitem.image.file_path" width="50" height="50" @click="uploadColumn(saveindex)" />
              <div v-else class="flex-row flex-align-c flex-justify-c update-load" @click="uploadColumn(saveindex)">
                <i class="el-icon-plus avatar-uploader-icon"></i>
              </div>
              <el-input style="margin:0 16px;" v-model="saveitem.input"></el-input>
              <el-radio-group v-model="saveitem.type">
                <el-radio label="1">客服</el-radio>
                <el-radio label="2">拨号</el-radio>
                <el-radio label="3">链接</el-radio>
                <el-radio label="4">分享</el-radio>
                <el-radio label="5">分享赚</el-radio>
              </el-radio-group>
              <div v-if="saveitem.type=='3'" class="link-box" @click="uploadFileToggle(saveindex)">{{saveitem.link}}</div>
            </div>
            <div>
              <i style="margin-right:20px;cursor: pointer;" class="el-icon-rank"></i>
            </div>
          </div>
        </el-form>
      </div>
    </div>

    <div class="wlm-form">
      <div class="wlm-form-header flex-row flex-justify-b flex-align-c">
        <span>下单设置</span>
      </div>
      <div class="wlm-form-content">
        <el-form ref="xds" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="170px" class="retail-form" label-position="right">
           <el-form-item label="公众号渠道是否强制绑定手机号">
            <el-radio-group v-model="formFormatData.formData.is_force_phone" style="margin-left:35px;">
              <el-radio label="1">是</el-radio>
              <el-radio label="2">否</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="新用户下单绑定手机号">
            <el-radio-group v-model="formFormatData.formData.bindmobile">
              <el-radio label="1">必须</el-radio>
              <el-radio label="0">不必须</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="是否启用购物车">
            <el-radio-group v-model="formFormatData.formData.cart_open">
              <el-radio label="1">启用</el-radio>
              <el-radio label="2">关闭</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="订单表单内容">
            <div style="width:30%">
              <div class="table-raido-header flex-row">
                <div class="table-left">内容</div>
                <div class="table-mid">是否启用</div>
              </div>
              <div class="table-raido-body flex-row">
                <div class="table-left">留言</div>
                <div class="table-mid">
                  <el-switch active-value="1" inactive-value="0" v-model="formFormatData.formData.order_form.remark"></el-switch>
                </div>
              </div>
              <div class="table-raido-body flex-row">
                <div class="table-left">电话</div>
                <div class="table-mid">
                  <el-switch active-value="1" inactive-value="0" v-model="formFormatData.formData.order_form.phone"></el-switch>
                </div>
              </div>
              <div class="table-raido-body flex-row">
                <div class="table-left">姓名</div>
                <div class="table-mid">
                  <el-switch active-value="1" inactive-value="0" v-model="formFormatData.formData.order_form.user_name"></el-switch>
                </div>
              </div>
            </div>
          </el-form-item>
        </el-form>
      </div>
    </div>
     <div class="wlm-form">
      <div class="wlm-form-header flex-row flex-justify-b flex-align-c">
        <span>订单设置</span>
      </div>
       <div class="wlm-form-content">
        <el-form ref="xds" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="170px" class="retail-form" label-position="right">
           <el-form-item label="过期订单">
            <el-radio-group v-model="formFormatData.formData.expired_order" style="margin-left:35px;">
              <el-radio label="1">开启隐藏</el-radio>
              <el-radio label="2">关闭隐藏</el-radio>
            </el-radio-group>
          </el-form-item>
           <el-form-item label="已退款订单">
            <el-radio-group v-model="formFormatData.formData.refunded_order" style="margin-left:35px;">
              <el-radio label="1">开启隐藏</el-radio>
              <el-radio label="2">关闭隐藏</el-radio>
            </el-radio-group>
          </el-form-item>
           <el-form-item label="已关闭订单">
            <el-radio-group v-model="formFormatData.formData.closed_order" style="margin-left:35px;">
              <el-radio label="1">开启隐藏</el-radio>
              <el-radio label="2">关闭隐藏</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="用户未按时付款订单">
            <el-radio-group v-model="formFormatData.formData.unpaid_order" style="margin-left:35px;">
              <el-radio label="1">开启隐藏</el-radio>
              <el-radio label="2">关闭隐藏</el-radio>
            </el-radio-group>
          </el-form-item>
          
           <!-- <el-checkbox-group v-model="formFormatData.formData.hide_info" >
                           <el-checkbox v-for="role in roledata" :label="role.value" :key="role.value">
                             {{role.label}}
                            </el-checkbox>
                      
                      </el-checkbox-group> -->
        </el-form>
          </div>
     </div>
    <div class="wlm-form">
      <div class="wlm-form-header flex-row flex-justify-b flex-align-c">
        <span>商家中心核销设置</span>
      </div>
      <div class="wlm-form-content">
        <el-form ref="cset" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="170px" class="retail-form" label-position="right">
          <el-form-item label="核销模式">
            <el-radio-group v-model="formFormatData.formData.vercode_model">
              <el-radio label="1">多码核销</el-radio>
              <el-radio label="2">单码核销</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div class="wlm-form">
      <div class="wlm-form-header flex-row flex-justify-b flex-align-c">
        <span>自定义图片</span>
      </div>
      <div class="wlm-form-content">
        <el-form ref="cset" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="170px" class="retail-form" label-position="right">
          <el-form-item label="好评榜">
              <choose-files ref="chooseFiles" :config="chooseHaoConfigs" :changeEvt="formFormatFiltersChange"></choose-files>
            <div class="form-help">建议尺寸294*106</div>
          </el-form-item>
            <el-form-item label="商家入驻">
           <choose-files ref="chooseFiles" :config="chooseshangConfigs" :changeEvt="formFormatFiltersChange"></choose-files>
            <div class="form-help">建议尺寸294*85</div>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div v-cloak class="wlm-fixed-btn flex-row flex-align-c flex-justify-c">
      <el-button size="small" @click="saveForm" type="primary">保存</el-button>
    </div>
  </div>
</template>

<script>
import ChooseFiles from '@/components/ChooseFiles/index'
import exceldown from '@/directive/exceldown'
import ChooseLink from '@/components/ChooseLink/index'
import Vue from 'vue'
import VueDND from 'awe-dnd'
Vue.use(VueDND)
import {
  otherGet,
  otherSave,
  clearPosterCache,
  clearDirectDroadcas
} from '@/api/setting'
import mixins from '@/mixins/mixins'
import { mapGetters } from 'vuex'
export default {
  mixins: [mixins.getters('Form')],
  name: 'OtherSettings',
  components: {
    ChooseFiles,
    ChooseLink
  },
  directives: {
    exceldown
  },
  computed: {
    orga() {
      return window.location.origin
    },
    ...mapGetters([
      'independent'
    ]),
    isIndependent() {
      return this.$store.getters.independent
    }
  },
  data() {
    return {
      $index: -1,
      isFirst: false,
      isDelay: false,
      isEnd: false,
      chooseFilesConfig: {
        type: ['image'],
        model: 'normal',
        initList: [],
        file_type: 'image'
      },
      chooseshangConfigs: {
        type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: false,
          model: 'display'
        },
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'business_banner',
          model: 'img'
        }
      },
      chooseHaoConfigs: {
        type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: false,
          model: 'display'
        },
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'good_banner',
          model: 'img'
        }
      },
      chooseLogoConfig: {
        type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: false,
          model: 'display'
        },
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'wechat_share_image',
          model: 'img'
        }
      },
      chooseLogoConfigs: {
        type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: false,
          model: 'display'
        },
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'live_wechat_img',
          model: 'img'
        }
      },
      chooseIconLinkConfig: {
        type: ['chooseLink'],
        initList: [],
        link_type: '1'
      },
      chooseCopyrightConfigs: {
        type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: false,
          model: 'display'
        },
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'live_sapp_img',
          model: 'img'
        }
      },
      chooseCopyrightConfig: {
        type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: false,
          model: 'display'
        },
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'app_share_image',
          model: 'img'
        }
      },
      formFormatData: {
        key: ['platform', 'cset'],
        api: {
          editForm: {
            api: otherGet,
            params: {
              always: true
            },
            filters: {
              img: {
                bindInit: ['chooseLogoConfig', 'chooseCopyrightConfig', 'chooseLogoConfigs', 'chooseCopyrightConfigs','chooseshangConfigs','chooseHaoConfigs']
              }
            }
          },
          submitForm: otherSave
        },
        formData: {
          is_force_phone:'2',
          expired_order:'2',
          closed_order:'2',
          unpaid_order:'2',
          refunded_order:'2',
          key: '',
          appcode: '',
          customer: '',
          type: '1',
          share_title: '',
          bindmobile: '0',
          share_describe: '',
          live_title: '',
          live_text: '',
          wechat_share_image: [],
          good_banner:[],
          business_banner:[],

          app_share_image: [],
          live_sapp_img: [],
          live_wechat_img: [],
          button: [],
          qr_type: '',
          vercode_model: '1',
          app_show: '1',
          reply_type: '',
          permanent: '1',
          poster_create_type: '0',
          order_form: { remark: '1', user_name: '1', phone: '1' },
          coupon: {
            coupon_title: '',
            coupon_reduction: '',
            coupon_rebate: '',
            coupon_freight: '',
            coupon_random: '',
            coupon_over_tip:'',
          },
          barrage: { is_barrage: '2' },
          cart_open: '2',
          tecent_map_key:'',
          kdn_AppKey: '',
          kdn_EBusinessID: '',
          kdnType: '1002'

        },
        rules: {
          // name: [{
          //   required: true,
          //   message: '请输入真实姓名',
          //   trigger: 'blur'
          // }],
          // image_id: [{
          //   required: true,
          //   message: '请输入真实姓名',
          //   trigger: 'blur'
          // }],
          // sort: [{
          //   required: true,
          //   message: '请输入真实姓名',
          //   trigger: 'blur'
          // }],
        }
      }
    }
  },
  mounted() {
  },
  methods: {
    qrtypebtn() {
      if (this.formFormatData.formData.qr_type == '2') {
        this.formFormatData.formData.permanent = '1'
      }
    },
    clearPoster() {
      clearPosterCache().then(res => {
        const { data: { msg, code } } = res
        if (code === 1) {
          this.$message.success(msg)
        } else {
          this.$message.error(msg)
        }
      })
    },
    clearDirectDroadcas() {
      clearDirectDroadcas().then(res => {
        const { data: { msg, code } } = res
        if (code === 1) {
          this.$message.success(msg)
        } else {
          this.$message.error(msg)
        }
      })
    },
    uploadChange({ displayData = [] }) {
      console.log(arguments, 'displayData22')

      this.formFormatData.formData.button[this.$index]['image'] = displayData[0]
    },
    uploadColumn(index) {
      console.log("55555555",this.$refs)
      this.$refs.chooseFilesIcon.toggle()
      this.$index = index
    },
    uploadFileToggle(index) {
      this.$index = index
      this.$refs.chooseIconLink.toggle()
    },
    uploadIconFileChange(files) {
      // const { currentRow: [file_path] } = files
      // if (file_path) {
      //   console.log(file_path, 'file_path')
      //   console.log(this.formFormatData.formData.button[this.$index], 'file_path22')
      //   this.formFormatData.formData.button[this.$index]['link'] = file_path
      // } else {
      //   this.$message.error('请选择链接~!')
      // }
       const { key } = files
      console.log("fdsfdsfd空间访客的健身房靠的就是",files)
      if(key==='ChooseLink'){
          const { currentRow: [file_path],displayData: [{  path}] } = files
         if (file_path || path) {
        console.log(file_path, 'file_path+++++')
         console.log("sdfdsds",path)

        // this.formFormatData.formData.rotation.map(res=>{
        //   res.link = file_path
        // })
         this.formFormatData.formData.button[this.$index]['link'] = file_path || path
      }else{
        this.$message.error('请选择链接~!')
      }
      }
    },
    saveForm() {
      // 保存到你要的那个form值里面
      this.formFormatSubmit()
    }
  }
}
</script>

<style lang="scss" scoped>
$update: 50px;

.other-settings {
  .fileItem {
    height: 66px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    font-size: 14px;
    border-radius: 3px;

    .fileName {
      text-align: right;
      width: 170px;
      padding-right: 20px;
      line-height: 60px;
    }
  }

  .fileItemHeader {
    height: 66px;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    font-size: 14px;

    .icon {
      margin-left: 170px;
      width: 50px;
    }

    .text {
      margin-left: 16px;
      width: 270px;
    }

    .link {
      margin-left: 16px;
      width: 290px;
    }
  }

  .update-load {
    display: inline-block;
    cursor: pointer;
    width: $update;
    height: $update;
    background: #fafbff;
    border: 1px dashed #c0ccda;
    color: #a8abb0;
    border-radius: 5px;

    i {
      font-size: 14px;
      color: #8c939d;
      width: $update;
      height: $update;
      line-height: $update;
      text-align: center;
    }
  }

  .link-box {
    margin-left: 20px;
    background: #e8effc;
    border: 0;
    width: 290px;
    height: 28px;
    line-height: 28px;
    border-radius: 3px;
    padding-left: 18px;
    cursor: pointer;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
  }
  .table-raido-header {
    background: #f2f2f2;
    padding: 10px;
    font-weight: 700;
    color: #909399;
  }

  .table-raido-body {
    padding: 10px;
    line-height: 24px;
    border-bottom: 1px solid rgb(235, 238, 245);
  }

  .table-left {
    width: 50%;
  }

  .table-mid {
    width: 50%;
  }
}
</style>
